









let defPkm = {
    race: {
        hel: 95,
        def: 95
    },
    xingge: {
        def: 1
    },
    nuli: {
        hel: 63,
        def: 63
    }
}


let atkpkm = {
    atk: 145,
    skill: 120,
}

function calcDmg(at, df,skillDmg,otherdmgChange = 1.5,lv=50) {
    let ret = parseInt((2*lv + 10)/250 * skillDmg * ( at/df ) +2) * (otherdmgChange)
    return [parseInt(ret*0.85), parseInt(ret)]
}

function getdata(race, nuli, ishel, rate) {
    return parseInt(((2 * parseInt(race) + 31 + nuli) * 50 / 100 + 5 + (ishel? 55:0)) * rate)
}



let race_pow = []
let nlz = 180
let nulia = 63
// for (let index = 1; index < nlz; index++) {
//     let race = {
//         hel: index,
//         def: nlz-index
//     }
//     defPkm.race = race
    for (let nuli = 0; nuli <= nulia; nuli++) {
        defPkm.nuli = {
            hel: nuli,
            def: nulia - nuli
        }
        let power = beAtk(defPkm, atkpkm)
        race_pow.push({
            race:defPkm.race, nuli:defPkm.nuli,power
        })
    }

    

// }

race_pow.sort((a, b) => a.power-b.power)

console.log(race_pow);
// console.log(race_pow[1]);
// console.log(race_pow[2]);
// console.log(race_pow[3]);
// console.log(race_pow[4]);
// console.log(race_pow[5]);
// console.log(race_pow[6]);
// console.log(race_pow[7]);
// console.log(race_pow[8]);




function beAtk(defPkm,atkpkm) {
    let defPkm_hel = getdata(defPkm.race.hel,defPkm.nuli.hel,1,1)
    let defPkm_def = getdata(defPkm.race.def,defPkm.nuli.def,0,(defPkm.xingge.def||1))
    let atk = getdata(atkpkm.atk,63,0,1.1)
    let dmg = calcDmg(atk,defPkm_def,atkpkm.skill)
    let power = ((dmg[1] / defPkm_hel) * 100)
    return power
}





























